<?php 

require 'phpQuery.php';
require 'QueryList.php';

use QL\QueryList;



$url=$_GET['url'];
$image=$_GET['image'];

$html = 'https:'.$url;
//$html = iconv('','UTF-8GBK',file_get_contents($html));
 $data = QueryList::Query($html,array(
        'content' => array('#articleContent','html','-p:last -.diversion-box a p')
    ),'','UTF-8','GB2312',true)->getData(function($item){
        return $item;
    });

 //print_r($data);
 //var_dump($data);

phpQuery::newDocumentFile($html); 
$title=pq("#articlewrap h1")->text();
$body=$data[0]['content'];

 ?>




<link rel="stylesheet" type="text/css" href="../editor/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="../editor/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="../editor/css/froala_editor.css">
<link rel="stylesheet" type="text/css" href="../editor/css/froala_editor.min.css">
<link rel="stylesheet" type="text/css" href="../editor/css/froala_page.css">
<link rel="stylesheet" type="text/css" href="../editor/css/froala_page.min.css">
<link rel="stylesheet" type="text/css" href="../editor/css/themes/dark.css">
<link rel="stylesheet" type="text/css" href="../editor/css/themes/dark.min.css">
<link rel="stylesheet" type="text/css" href="../editor/css/themes/gray.css">
<link rel="stylesheet" type="text/css" href="../editor/css/themes/gray.min.css">
<link rel="stylesheet" type="text/css" href="../editor/css/themes/red.css">
<link rel="stylesheet" type="text/css" href="../editor/css/themes/red.min.css">
<link rel="stylesheet" type="text/css" href="../editor/css/themes/royal.css">
<link rel="stylesheet" type="text/css" href="../editor/css/themes/royal.min.css">


<form  action="ss_sql.php" method="post" style="margin-top:30px;" >
<input  name="title" value="<? echo  $title;?>" style="width:100%;line-height:30px;border:solid 2px black;" >
<input  name="image" value="<? echo  $image;?>" style="display:none;" >
<input  name="url" value="<? echo  $url;?>" style="display:none;" >
<textarea  id="edit" class="editor" name="bd"  style="width: 100%;height: 600px;">

<? echo  $body; ?>




</textarea>
<input  type="submit" value="确定发布" style="width:200px;display:block;margin:auto;height:50px;font-size:30px;">
</form>

<script>
$(function() {
    $('.editor').editable({
        inlineMode: false,
        theme: 'gray',
        //模版
        height: '200px' //高度
    });
 
})
</script>

<script src="../editor/js/libs/jquery-1.11.1.min.js"></script> 
<script src="../editor/js/froala_editor.min.js"></script> 
<!--[if lt IE 9]>
    <script src="../js/froala_editor_ie8.min.js"></script>
<![endif]--> 
<script src="../editor/js/plugins/tables.min.js"></script> 
<script src="../editor/js/plugins/lists.min.js"></script> 
<script src="../editor/js/plugins/colors.min.js"></script> 
<script src="../editor/js/plugins/media_manager.min.js"></script> 
<script src="../editor/js/plugins/font_family.min.js"></script> 
<script src="../editor/js/plugins/font_size.min.js"></script> 
<script src="../editor/js/plugins/block_styles.min.js"></script> 
<script src="../editor/js/plugins/video.min.js"></script> 
<script src="../editor/js/langs/zh_cn.js"></script>
    <script>
        $(function () {
            $('#edit').editable({
                inlineMode: false,
                alwaysBlank: true,
                language: "zh_cn",
                direction: "ltr",
                allowedImageTypes: ["jpeg", "jpg", "png", "gif"],
                autosave: true,
                autosaveInterval: 2500,
                saveURL: '../editor/img.php',
                saveParams: { postId: "123" },
                spellcheck: true,
                plainPaste: true,
                imageButtons: ["floatImageLeft", "floatImageNone", "floatImageRight", "linkImage", "replaceImage", "removeImage"],
                imageUploadURL: '../editor/img.php',
                imageParams: { postId: "123" },
                enableScript: false
 
            })
        });
    </script>